<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:view>

        <ui:composition template="maintemplate.xhtml">

            <ui:define name="title">#{labels.index_page_title}</ui:define>
            <ui:define name="body">

                <c:choose>

                    <c:when test="#{FlowManagedBean.checkIfTheUserIsAdmin()}">

                        <h:outputLabel value="Hello #{sessionScope.username}"/>

                        <h:form>

                            <h:commandButton action="#{FlowManagedBean.goToAdmin}" value="Add new comment"/>

                        </h:form>

                    </c:when>

                    <c:otherwise>

                        <h:form>

                            <h:outputLabel value="Hello GUEST"/>
                            Are you the Admin? Please, log in :D<h:commandLink action="#{FlowManagedBean.goToLogin}" value="Log In"/>

                        </h:form>

                    </c:otherwise>

                </c:choose>

            </ui:define>

        </ui:composition>

    </f:view>

</html>
